import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/vue-element-admin/user/login',
    method: 'post',
    data
  })
}
// 医生登录
export function loginDoctor(data) {
  return request({
    url: '/doctor/login',
    method: 'post',
    data
  })
}
// 病人登录
export function loginPatient(data) {
  return request({
    url: '/patient/login',
    method: 'post',
    data
  })
}

// 注册
export function register(data) {
  return request({
    // url: '/user/login',
    url: '/patient/register',
    // url: '/user/login', // 跨域
    method: 'post',
    data
  })
}
// 获取医生信息
export function getInfoDoctor(token) {
  return request({
    url: '/doctor/getdoctorinfo',
    method: 'get',
    headers: {
      'Authorization': token.token // 请求头
    }
  })
}
// 获取病人信息
export function getInfoPatient(token) {
  return request({
    url: '/patient/get_user_info',
    method: 'get',
    headers: {
      'Authorization': token.token // 请求头
    }
  })
}
export function logout() {
  return request({
    url: '/vue-element-admin/user/logout',
    method: 'post'
  })
}

// 病人信息修改
export const updatePatientInfo = (obj) => {
  return request({
    url: '/patient/patient_update_info',
    method: 'post',
    data: obj
  })
}

// 医生信息修改
export const updateDoctorInfo = (obj) => {
  return request({
    url: '/doctor/doctor_update_info',
    method: 'post',
    data: obj
  })
}

// // 医生信息查询
// export function getInfoDoctor(name) {
//   return request({
//     url: '/doctor/target',
//     method: 'get',
//     name
//   })
// }

// 医生头像修改
export const updateDoctorAt = (obj) => {
  return request({
    url: '/doctor/profilephoto_upload',
    method: 'post',
    data: obj
  })
}
